package models

import (
	"log"
	"quantization_trading/src/util"
)

//策略信息关联订单
type StrategyInfoAndOrder struct {
	Id int `json:"id"`

	StrategyInfoId int `json:"strategy_info_id"` //策略信息id
	Cid string `json:"cid"`	// 用户自定义订单id
	Type int `json:"type"`	//1.表示开仓订单、2.表示平仓订单
}

//添加
func AddStrategyInfoAndOrder(strategyInfoAndOrder *StrategyInfoAndOrder) (bool,int){
	if err := db.Create(strategyInfoAndOrder).Error; err != nil {
		log.Fatal(err)
		return false, util.ADD_ERROR
	}
	return true,util.ADD_SUSSESS
}